//-----------------------------------------------------------------------
// <copyright file="StringReplaceTest.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
// </copyright>
// <author>Shaun Wilde</author>
// <email>v-swilde</email>
// <date>2006-02-20</date>
// <summary>Tests tring replace task</summary>
//-----------------------------------------------------------------------

namespace Microsoft.Sdc.Tasks.Test
{
    using System;
    using System.Text;
    using System.Collections.Generic;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Microsoft.Sdc.Tasks;

    /// <summary>
    /// Unit Test for StringReplace task
    /// </summary>
    [TestClass]
    public class StringReplaceTest
    {
        public StringReplaceTest()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void TestStringReplace()
        {
            StringReplace replace = new StringReplace();
            replace.Input = "the quick brown dog";
            replace.OldValue = "brown";
            replace.NewValue = "red";

            bool replaceValue = replace.Execute();

            Assert.IsTrue(replaceValue, "StringReplace task failed");

            Assert.AreEqual<string>(replace.Output, "the quick red dog", "The StringReplace task failed to perform as expected");
        }
    }
}
